package com.xl.studentpass.controller;

import com.xl.studentpass.service.IndexDataService;
import com.xl.studentpass.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.concurrent.ExecutionException;

/**
 * @author: xl
 * @createTime: 2023/5/27 15:06:47
 * @program: student-pass
 * @e-mail: 2199396150@qq.com
 * @description: 首页数据展示接口
 */
@RestController
@RequestMapping("/index/data")
@Api(tags = "首页获取数据接口")
@Slf4j
public class IndexDataController {

    @Resource
    IndexDataService indexDataService;

    @GetMapping("/topN")
    @ApiOperation("获取任务奖金top")
    public R getTopN(
            @RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
            @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) throws ExecutionException, InterruptedException {
        log.info(this.getClass().getSimpleName() + "=================获取任务奖金top");
        return indexDataService.getTopN(pageNo, pageSize);
    }
}
